<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     <script>
        // 创建 Person 类  
        function Person(name, age) 
         { 
         this.name = name; 
         this.age = age; 
         } 
        
         // 为 Person 添加 run 方法  
         Person.prototype.run = function() 
         { 
          console.log(`${this.name}`); 
          }; 
    
        // 创建 Teacher 类，继承自 Person  
        function Teacher(name, age, addr) 
         {
         Person.call(this, name, age); 
         this.addr = addr;// 初始化 Teacher 特有的 addr 属性 
         }
        
        // 设置 Teacher 的原型为 Person 的实例，以实现继承  
         Teacher.prototype = Object.create(Person.prototype); 
        // 修正 constructor 指向，使其指向 Teacher  
         Teacher.prototype.constructor = Teacher;
         var t1 = new Teacher('wang', 20, '629'); 
         t1.run();
         </script>
</body>
</html>